import { getShopById, getMyInformation,getArrayDetail } from "@/api"
const state = {
    artDetail:{}
}

const mutations = {
    ARTDETAIL(context,data){
        context.artDetail = data
    },
    RESETARTDETAIL(context){
        context.artDetail = {}
    }
}

const actions = {
    async artDetail({commit},id){
        commit("RESETARTDETAIL")
        let shop = await getShopById(id)
        let result = shop[0]
        // 获取作者，持有者，合集信息
        // let creatorInfo = await getMyInformation(result.creator_address)
        // let ownerInfo = await getMyInformation(result.owner)
        // let arrayInfo = await getArrayDetail(result.array_id)
        // result.creatorInfo = creatorInfo[0]
        // result.ownerInfo = ownerInfo[0]
        // result.arrayInfo = arrayInfo[0]
        // console.log(creatorInfo,ownerInfo)
        commit("ARTDETAIL", result)
    }
}

const getters = {}

export default {
    state,
    mutations,
    actions,
    getters
}